package com.easy.dn.ui.main.presenter;

import com.easy.common.baserx.RxSubscriber;
import com.easy.dn.bean.ListBean;
import com.easy.dn.bean.ProfessionTypeBean;
import com.easy.dn.ui.main.contract.ProfessionTypeContract;

import java.util.Map;

/**
 * Created by 丁宁
 * on 2017/5/16.
 */

public class ProfessionTypePresenter extends ProfessionTypeContract.Presenter {
    @Override
    public void getData(Map<String, ProfessionTypeBean> mSelect) {

        mRxManage.add(mModel.getProfessionList(mSelect)
                .subscribe(new RxSubscriber<ListBean>(mContext, true) {
                    @Override
                    protected void _onNext(ListBean list) {
                        mView.returnProfessionList(list);
                    }

                    @Override
                    protected void _onError(String message) {

                    }
                }));
    }

    //过滤 搜索功能
    @Override
    public void getSelectData(Map<String, ProfessionTypeBean> mSelect, String filterStr) {
        mRxManage.add(mModel.getSelectData(mSelect, filterStr)
                .subscribe(new RxSubscriber<ListBean>(mContext, false) {
                    @Override
                    protected void _onNext(ListBean list) {
                        mView.returnProfessionList(list);
                    }

                    @Override
                    protected void _onError(String message) {

                    }
                }));
    }
}
